package com.jinzhuo.music.service;

import com.jinzhuo.music.dao.CollectionMapper;
import com.jinzhuo.music.domain.Collect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollectionServiceImpl implements CollectionService {
    @Autowired
    private CollectionMapper collectionMapper;
    @Override
    public boolean createCollection(Collect pojo) {
        return collectionMapper.createCollection(pojo)>0;
    }

    @Override
    public boolean deleteCollection(Integer userId,Integer songId) {
        return collectionMapper.deleteCollection(userId,songId)>0;
    }

    @Override
    public List<Collect> queryAllCollection() {
        return collectionMapper.queryAllCollection();
    }

    @Override
    public List<Collect> queryCollectionByUserId(Integer userId) {
        return collectionMapper.queryCollectionByUserId(userId);
    }

    @Override
    public boolean existSongId(Integer userId, Integer songId) {
        return collectionMapper.existSongId(userId,songId)>0;
    }


}
